package com.example.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.config.BaseContext;

@RestController
@RequestMapping("/user")
public class UserController {

	@GetMapping("setLocal")
	public String setLocal(HttpServletRequest request) {
		request.getSession().setAttribute("employee", 1L);
		BaseContext.setCurrentId(1L);
		return "setLocal成功";
	}
	
	@GetMapping("getLocal")
	public String getLocal() {
		Long currentId = BaseContext.getCurrentId();
		return "getLocal成功::" + currentId;
	}
}
